package com.smallrig.extension.utils;


public class SpiUtils {

    /**
     * intf 是否继承 clazz
     * @param intf
     * @param clazz
     * @return
     */
    public static boolean asFrom(Class intf,Class clazz){
        if(intf.equals(clazz)){
            return true;
        }
        for (Class anInterface : intf.getInterfaces()) {
            if(anInterface.equals(clazz)){
                return true;
            }else{
                boolean f = false;
                for (Class acc : anInterface.getInterfaces()) {
                    f |= asFrom(acc,clazz);
                }
                return f;
            }
        }
        return false;
    }


}
